from flask import Flask, jsonify
from webtest import printhello, printgoodbye
app = Flask(__name__)
'''
@app.route('/')
def hello_world():
    s = printhello()
    return s
'''
@app.route('/',methods=['GET'])
def start_button():
    return '''<form action="/start" method="post">
              <p><button type="submit">Start scan</button></p>
              </form>'''

@app.route('/start',methods=['POST'])
def start():
    s = printhello()
    return jsonify(s)

if __name__ == '__main__':
    #app.recSocket.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)  
    app.run(host='0.0.0.0',port=5000,debug=True)
